public class Demo {
    //计算1-100奇数的和
/*    public static void main(String[] args) {
        int i = 1;
        int count = 0;
        while(i<=100){
            count+=i;
            i+=2;
        }
        System.out.println(count);
    }*/
    //计算1-100偶数的和
/*    public static void main(String[] args) {
        int i = 0;
        int count = 0;
        while(i<=100){
            count+=i;
            i+=2;
        }
        System.out.println(count);
    }*/
/*    public static void main(String[] args) {
        for (int i = 1; i <= 100; i++) {
            if (i % 15 != 0) {
                continue;
            } else {
                System.out.println(i);
            }
        }
    }*/
    //求最大公约数
    public static void main(String[] args) {
        int a = 24;
        int b = 18;
        int c = a % b;
        while (c != 0) {
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);

    }


}
